package com.bflow.impl;

import com.bflow.api.IBflowCacheService;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 功能：BflowCacheService 缓存接口
 * 作者：haowen
 * 日期：2018-12-18
 */
@Service("bflowCacheService")
public class BflowCacheServiceImpl implements IBflowCacheService {

	//之后可以替换 其他方案
	private static Map<String, String> CACHE = new ConcurrentHashMap<>(64);

	@Override
	public String get(String cacheKey) {
		return CACHE.get(CACHE_PREFIX+cacheKey);
	}

	@Override
	public void put(String cacheKey, String value) {
		CACHE.put(CACHE_PREFIX+cacheKey, value);
	}

	@Override
	public void del(String cacheKey) {
		CACHE.remove(CACHE_PREFIX+cacheKey);
	}
}
